package com.cf.service.impl;

import com.cf.dao.AccountTypeDao;
import com.cf.dao.AccountTypeIdTypeDao;
import com.cf.entity.AccountType;
import com.cf.entity.IdType;
import com.cf.service.AccountTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class AccountTypeServiceImpl implements AccountTypeService {

    @Autowired
    private AccountTypeDao accountTypeDao;

    @Override
    public List<AccountType> selectAllAccountType() {
        return accountTypeDao.selectAllAccountType();
    }

    @Override
    public PageInfo<AccountType> selectAllAccountTypes(int pagenum, int pagesize, Map map) {
        PageHelper.startPage(pagenum,pagesize);
        List<AccountType> accountTypes = accountTypeDao.selectAllAccountTypes(map);
        PageInfo<AccountType> accountTypePageInfo = new PageInfo<>(accountTypes);
        return accountTypePageInfo;
    }

    @Override
    public int updateAccountType(AccountType accountType) {
        return accountTypeDao.updateAccountType(accountType);
    }

    @Override
    public int addAccountType(AccountType accountType) {
        return accountTypeDao.addAccountType(accountType);
    }

    @Override
    public int delAccountType(long id) {
        return accountTypeDao.delAccountType(id);
    }

    @Override
    public AccountType selectByIds(long id) {
        return accountTypeDao.selectByIds(id);
    }
}
